<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var sum = 100;
        var i = prompt('请输入您要的操作：' + '\n' + '1.存钱' + '\n' + '2.取钱' + '\n' + '3.显示余额' + '\n' + '4.退出');
        switch (i) {
            case '1':
                var j = prompt('请输入存钱数：');
                sum += parseFloat(j);
                alert('您的余额为：' + sum + '');
                break;
            case '2':
                var j = prompt('请输入取钱数：');
                if (j > sum) {
                    alert('您的余额不足！');
                    break;
                }
                sum = sum - j;
                alert('您的余额为：' + sum + '');
                break;
            case '3':
                alert('您的余额为：' + sum + '');
                break;
            case '4':
                alert('您正在退出');
                break;

        }
    </script>
</body>

</html>